var express = require('express');
var MysqlDao = require('../dao/mysqldao');
var router = express.Router();
var mysqldao = new MysqlDao();

/* GET users listing. */
router.get('/', function(req, res, next) {
  res.send('respond with data -- used as data api');
});

/* GET users listing. */
router.get('/test', function(req, res, next) {
  var sql = 'select * from case_a_artinfo';
  mysqldao.query(sql,function(result){
      res.send(result);
  });
});

/* Get artinfo list */
router.get('/artinfo', function(req,res,next) {
    // var data = [
    //         {'img':'images/0.jpg','name':'杨耀宁中国画展','enddate':'2018-12-25','org':'江苏省美术馆新馆','note':'简介……………………'},
    //         {'img':'images/0.jpg','name':'杨耀宁中国画展','enddate':'2018-12-25','org':'江苏省美术馆新馆','note':'简介……………………'},
    //         {'img':'images/0.jpg','name':'杨耀宁中国画展','enddate':'2018-12-25','org':'江苏省美术馆新馆','note':'简介……………………'},
    //         {'img':'images/0.jpg','name':'杨耀宁中国画展','enddate':'2018-12-25','org':'江苏省美术馆新馆','note':'简介……………………'},
    //         {'img':'images/0.jpg','name':'杨耀宁中国画展','enddate':'2018-12-25','org':'江苏省美术馆新馆','note':'简介……………………'},
    //     ];
    // res.send(data);
    var sql = 'select * from case_a_artinfo';
    mysqldao.query(sql, function (result) {
        res.send(result);
    });
});

module.exports = router;
